home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / e_to_l / imlib201 / usersdoc.doc < prev    next >
Encoding:
Text File  |  1996-09-15  |  35.7 KB  |  1,086 lines

  1. Borland Pascal and Delphi Users' Guide
  2.  
  3. Image Lite DLL /VCL version 2.0 (c)  Copyright 1995 by:
  4. Kevin Adams (CIS) 74742,1444 and Jan Dekkers (CIS) 72130,353
  5.  
  6. Technical support for C, C++, VB applications:
  7. Kevin Adams: CIS) 74742,1444
  8.  
  9. Technical support  for Delphi, Pascal and VB  applications:
  10. Jan Dekkers CIS) 72130,353
  11.  
  12. Other means  of technical support are currently not provided.
  13. ____________________________________________________________________________
  14.  
  15. What is ImageLib DLL/VCL?
  16.  
  17. The ImageLib VCL'S\DLL is an inexpensive way to add Jpeg, Gif and Pcx to your
  18. applications. Yes, there are image libraries supporting many more formats
  19. than ImageLib, but those libraries are more expensive and add more overhead
  20. to your applications.
  21.  
  22. ImageLib is a enhanced Timage and TDBImage VCL/DLL with the following
  23. added features:
  24.  
  25. * Enables the reading and writing of JPEG images to/from a file or a TBlobfield;
  26. * Jpeg 4, 8 and 24 bit dithering;
  27. * Jpeg 0 to 100% save quality;
  28. * Jpeg 0 to 100% smoothing;
  29. * enables the reading of GIF images from a file or a TBlobfield;
  30. * enables the reading of PCX images from a file or a TBlobfield;
  31. * enables the reading and writing of BMP images to/from a file or a TBlobfield;
  32. * Enables the reading and writing of AVI images to/from TBlobfield;
  33. * Enables the reading and writing of MOV images to/from TBlobfield;
  34. * Enables the reading and writing of WAV images to/from TBlobfield;
  35. * Enables the reading and writing of RMI images to/from TBlobfield;
  36. * Enables the reading and writing of MID images to/from TBlobfield;
  37. * enables the reading and writing of ICO images to/from a file(Delphi inherited);
  38. * enables the reading and writing of WMF images to/from a file (Delphi inherited);
  39. * DLL Callback funtion  shows  a progress bar and  processes  windows messages;
  40. * 1 line of code displays all image formats on the same canvas;
  41. * no code necessary (VCL) to display all image formats from a TBlobfield;
  42. * Loads/Saves all Tblobfield images to/from file;
  43. * converts all Tblobfield images to Jpeg/Bmp file;
  44. * pastes images from Clipboard and stores as a Jpeg/Bmp file/Blob;and
  45. * retrieves File/Blob info without actually opening the file.
  46.  
  47. ____________________________________________________________________________
  48.  
  49.  
  50. Installation Instructions
  51.  
  52. BACKUP YOUR \DELPHI\BIN\COMPLIB.DCL  Better safe than ;-(
  53.  
  54. Copy the IMGLIB20.dll to a directory on your path or to the
  55. windows\system directory (best choice). THIS IS A DISTRIBUTABLE FILE.
  56.  
  57. If you have installed an earlier version of TMultiImage, you must
  58. remove the old TMultiImage component. Execute Delphi. In Delphi select
  59. Options\Install components (select reg_image or reg_im20) and remove.
  60. Press OK. Delete reg_image.pas and/or reg_im20.pas from your system.
  61.  
  62. Unzip MIMAGE.ZIP into a new directory. Copy the following files into a
  63. directory containing your 3rd party added VCL's: (If you don't have a
  64. directory yet please make one)
  65.  
  66. MULTIREG.PAS, TMULTI.PAS, TDBMULTI.PAS and DLL20LIN.DCU
  67.  
  68. Execute Delphi. In Delphi select Options\Install components\ Add and
  69. browse your 3rd party added VCL's directory. Select MULTIREG and press
  70. the OK button.
  71.  
  72. After the library is rebuilt, you will notice 4 new icons on your Delphi
  73. toolbar under images called: MultiImage, DBMultiImage, DBMultiMedia and
  74. DBMediaPlayer.
  75.  
  76.  
  77. Installation Instructions for the Examples
  78.  
  79. In delphi select Open\Project and open one of the projects in the
  80. newly created directory. Select rebuild. Run the program.
  81. ______________________________________________________________________________
  82.  
  83. IMPORTANT: IF YOU INSTALLED THE OLD MULTIIMAGE or DBMultiImage
  84.  
  85. What to do with your existing programs using the old MultiImage VCL:
  86.  
  87. Incase of OLD MULTIIMAGE:
  88.  
  89. Change the uses clause of your programs from REG_IMAG or REG_IM20 to TMULTI.
  90. When you startup your existing programs using the MultiImage VCL you might
  91. notice a complain (Property JPegSaveSmooh doesnÆt exist.)  This is because we
  92. forgot the T in smooth in the old vcl. To fix this,  load the FORM (the *.DFM)
  93. file complaining about this and replace JPegSaveSmooh with JPegSaveSmooTh.
  94. Property JPegSaveFileName is renamed to DefSaveFileName.
  95.  
  96. ______________________________________________________________________________
  97.  
  98. Incase of OLD TDBMULTIIMAGE:
  99.  
  100. Change the uses clause of your programs from REG_IM20 to TDBMULTI.
  101. ______________________________________________________________________________
  102.  
  103.  
  104. The new VCL objects added to your toolbar are called MultiImage, DBMultiImage,
  105. DBMultiMedia and DBMediaPlayer.
  106.  
  107.  
  108. TMULTIIMAGE:  JPEG, BMP, GIF, WMF, ICO and PCX.
  109. ------------
  110. Mutltimage is derived  from  TGraphicsControl. It has the same properties as
  111. Delphi's TImage with the following additions:
  112.  
  113. property JPegSaveQuality      0...100
  114.                               0 is poor and 100 excellent.  We  normally
  115.                               use  25 to have a reasonable quality with
  116.                               1/10 savings in size.
  117.  
  118.  
  119. (Changed property was JPegSaveSmooh}
  120.  
  121. property JPegSaveSmooth       0..100
  122.                               0 is no smoothing  and 100  is full
  123.                               smoothing.
  124.  
  125. procedure SaveAsJpg(FN : TFilename); save jpeg
  126.  
  127.  
  128.  
  129. (Changed property was JPGSaveFileName}
  130.  
  131. property DefSaveFileName      The filename of the image being saved.
  132.  
  133. Example:
  134. --------
  135. procedure TForm1.SaveButtonClick(Sender: TObject);
  136. begin
  137.  
  138. {Open save dialog}
  139. if SaveDialog1.execute then begin
  140.     MultiImage1.JPegSaveQuality:=25;
  141.     MultiImage1.JPegSaveSmooth:=5;
  142.     MultiImage1.DefSaveFileName:=SaveDialog1.FileName;
  143.     MultiImage1.SaveAsJpg('');
  144.  end;
  145. end;
  146. (or you can use)
  147.  
  148. procedure TForm1.SaveButtonClick(Sender: TObject);
  149. begin
  150.  {Open save dialog}
  151.  if SaveDialog1.execute then begin
  152.     MultiImage1.SaveAsJpg(SaveDialog1.FileName);
  153.  end;
  154. end;
  155. ___________________________________________________________
  156.  
  157. procedure SaveAsBMP(FN : TFilename); save jpeg
  158.  
  159. Example:
  160. --------
  161. procedure TForm1.SaveButtonClick(Sender: TObject);
  162. begin
  163.  {Open save dialog}
  164.  if SaveDialog1.execute then begin
  165.     MultiImage1.DefSaveFileName:=SaveDialog1.FileName;
  166.     MultiImage1.SaveAsBMP('');
  167.  end;
  168. end;
  169.  
  170. (or you can use)
  171.  
  172. procedure TForm1.SaveButtonClick(Sender: TObject);
  173. begin
  174.  {Open save dialog}
  175.  if SaveDialog1.execute then begin
  176.     MultiImage1.SaveAsBMP(SaveDialog1.FileName);
  177.  end;
  178. end;
  179. ______________________________________________________________________________
  180.  
  181. property JPegDither      0: No dithering 24 bit
  182.                          1: One Pass No dither
  183.                          2: One Pass dither
  184.                          3: Two Pass No dither
  185.                          4: Two Pass dither
  186.  
  187. property JPegResolution  4 bit    (16 colors)
  188.                          8 bit   (256 colors)
  189.                          24 bit  (16 Million colors)
  190.  
  191. property ImageName       Procedure to load an image and the 
  192.                          filename of the image being loaded.
  193.  
  194.  
  195. Example:
  196. ---------
  197. procedure TForm1.OpenFileClick(Sender: TObject);
  198. begin
  199.   if OpenDialog1.execute then begin
  200.    {set hourglass cursor}
  201.     screen.cursor:=crHourGlass;                       
  202.    {set dither}
  203.     MultiImage1.JPegDither:=4;
  204.     {set resolution}
  205.     MultiImage1.JPegResolution:=8;
  206.     {display an image using the vcl}
  207.     MultiImage1.imagename:=OpenDialog1.filename;
  208.    {set default cursor}
  209.     screen.cursor:=crDefault;
  210.   end;
  211. end;
  212. ______________________________________________________________________________ 
  213.  
  214.  
  215.  
  216. function GetInfoAndType(filename : TFilename) : Boolean;
  217.  
  218. GetInfoAndType is a very fast dll function which retrieves image information 
  219. without actually loading the image. GetInfoAndType will return true, if 
  220. successful, and will store the following information:
  221.  
  222.     BFiletype           :  String;      JPEG, BMP, GIF, PCX, ICO, WMF
  223.     Bwidth              :  Integer;     Width of the image
  224.     BHeight             :  Integer;     Height of the image
  225.     BSize               :  Longint;     File size in bytes
  226.     Bbitspixel          :  Integer;     Bits per Pixel (If available)
  227.     Bplanes             :  Integer;     Planes (If available)
  228.     Bnumcolors          :  Integer;     Number of colors (If available)
  229.     Bcompression        :  String;      Compression method (If available)
  230.  
  231. for ICO and WMF the image must be displayed to return the following:
  232.     Bwidth              :  Integer;     Width of the image 
  233.     BHeight             :  Integer;     Height of the image
  234.  
  235. for ICO and WMF the following return is always 0
  236.     Bbitspixel          :  Integer;     Bits per Pixel (If available)
  237.     Bplanes             :  Integer;     Planes (If available)
  238.     Bnumcolors          :  Integer;     Number of colors (If available)
  239.  
  240. Note: GetInfoAndType is called automatically by the VCL while an Image
  241. is being displayed. If no Image is displayed you can call this function
  242. manually.
  243.  
  244.  
  245. Example:
  246. -------
  247. procedure TForm1.DisPlayInfo(filename : TFilename);
  248. begin
  249.     if GetInfoAndType(filename) then begin
  250.        Edit1.Text:=IntToStr(MultiImage1.Bwidth);
  251.        Edit2.Text:=IntToStr(MultiImage1.BHeight);
  252.        Edit3.Text:=IntToStr(MultiImage1.Bbitspixel);
  253.        Edit4.Text:=IntToStr(MultiImage1.Bplanes);
  254.        Edit5.Text:=IntToStr(MultiImage1.Bnumcolors);
  255.        Edit6.Text:=MultiImage1.BFileType;
  256.        Edit7.Text:=MultiImage1.Bcompression;
  257.        Edit8.Text:=IntToStr(MultiImage1.BSize);
  258.      end else begin
  259.        Edit1.Text:='';
  260.        Edit2.Text:='';
  261.        Edit3.Text:='';
  262.        Edit4.Text:='';
  263.        Edit5.Text:='';
  264.        Edit6.Text:='';
  265.        Edit7.Text:='';
  266.        Edit8.Text:='';
  267.      end;
  268. end;
  269.  
  270. ______________________________________________________________________________
  271.  
  272. DLL Image CallBack Procedure
  273.  
  274. The callback procedure is generated by the DLL and has 2 main goals:
  275.  
  276. 1:   To show a progress bar to the user
  277. 2:   To process windows messages to give other windows programs the 
  278.      chance to do what they have to do.
  279.  
  280. It's up to you, the application developer, to process the application's
  281. messageloop. You can do this by adding APPLICATION.PROCESSMESSAGES in the 
  282. callback procedure.
  283.  
  284.  The Dll expects a callback procedure of the following type:
  285.  
  286. type
  287.  TCallBackFunction = procedure(i:integer);
  288.  
  289. var (pointer to the callback type)
  290.  TMultiImageCallBack   :  TCallBackFunction;
  291.  
  292.  
  293. There are two things you MUST do to add a callback to your app:
  294.  
  295. 1: You need to declare a Procedure of the type above with the EXPORT clause:
  296.  
  297. procedure MyCallBack(i : integer); export;
  298. begin
  299.   Form1.Gauge1.Progress:=i;
  300.   Application.ProcessMessages;
  301. end;
  302.  
  303. 2: You need to register the callback to the VCL. The best place to do that
  304.    is in the FormCreate function:
  305.  
  306. procedure TForm1.FormCreate(Sender: TObject);
  307. begin
  308.      TMultiImageCallBack:=MyCallBack;
  309. end;
  310.  
  311. ____________________________________________________________________________________________________________________________________________________________
  312.  
  313. TDBMULTIIMAGE: JPEG, BMP, GIF and PCX from a TBLOBField.
  314.  
  315. TDBMutltimage is the data-aware VCL version of TMultiImage. DBMutltimage is
  316. derived  from TCustomControl. It has the same properties as Delphi's TDBImage
  317. with the following additions:
  318.  
  319. property JPegSaveQuality      0...100
  320.                               0 is poor and 100 excellent.  We  normally 
  321.                               use  25 to have a reasonable quality with
  322.                               1/10 savings in size.
  323.  
  324. property JPegSaveSmooth       0..100    
  325.                               0 is no smoothing  and 100  is full
  326.                               smoothing. 
  327.  
  328. procedure SaveToFileAsJpg(FN : TFilename); saves the Image displayed 
  329.                                            on the screen as a Jpeg file.
  330.  
  331. Example:
  332. -------
  333. procedure TForm1.BitBtn8Click(Sender: TObject);
  334.  {save or convert the blob to a Jpeg file}
  335.  {make sure that the blob is displayed before saving to file}
  336. begin
  337.   {set SaveDialog filter to display jpeg's only}
  338.   SaveDialog2.filter:='Jpeg files|*.JPG';
  339.  
  340.   {set SaveDialog Default extension}
  341.   SaveDialog2.DefaultExt:='JPG';
  342.  
  343.   TDBMultiImage1.JPegSaveQuality:=25;
  344.   
  345.   TDBMultiImage1.JPegSaveSmooth:=5;
  346.  
  347.   if SaveDialog2.Execute then
  348.   {Save it}
  349.   TDBMultiImage1.SaveToFileAsJpeg(SaveDialog2.Filename);
  350.  
  351.   {reset the gauge to 0}
  352.   Gauge1.Progress:=0;
  353. end;
  354. ------------------------------------------------------------------
  355.  
  356. procedure SaveToFileAsBMP(FN : TFilename); save the Image displayed on 
  357.                                            the screen as a BMP file.
  358.  
  359. Example:
  360. -------
  361. procedure TForm1.BitBtn7Click(Sender: TObject);
  362.  {save or convert the blob to a BMP file}
  363.  {make sure that the blob is displayed before saving to file}
  364. begin
  365.   {set SaveDialog filter to display bmp's only}
  366.   SaveDialog2.filter:='BMP files|*.BMP';
  367.  
  368.   {set SaveDialog Default extension}
  369.   SaveDialog2.DefaultExt:='BMP';
  370.  
  371.  
  372.   if SaveDialog2.Execute then
  373.   {Save it}
  374.   TDBMultiImage1.SaveToFileAsBMP(SaveDialog2.Filename);
  375.  
  376.   {reset the gauge to 0}
  377.   Gauge1.Progress:=0;
  378. end;
  379.  
  380. -----------------------------------------------------------------------
  381.  
  382. function GetInfoAndType : String; {return extension type}
  383.  
  384. GetInfoAndType is a very fast dll function which retrieves image info.
  385. GetInfoAndType will return the file extension and will store the
  386. following information:
  387.  
  388.     BFiletype           :  String;      JPEG, BMP, GIF, PCX
  389.     Bwidth              :  Integer;     Width of the image
  390.     BHeight             :  Integer;     Height of the image
  391.     BSize               :  Longint;     File size in bytes
  392.     Bbitspixel          :  Integer;     Bits per Pixel (If available)
  393.     Bplanes             :  Integer;     Planes (If available)
  394.     Bnumcolors          :  Integer;     Number of colors (If available)
  395.     Bcompression        :  String;      Compression method (If available)
  396.  
  397. Note that GetInfoAndType is called automatically by the VCL if autodisplay is  
  398. true by browsing through the open database. If autodisplay = false then to get 
  399. the blob info you need to make the call by yourself.
  400.  
  401. example
  402. --------
  403. procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField);
  404. begin
  405.  {Reset the Gauge}
  406.   Gauge1.Progress:=0;
  407.  {If TDBMultiImage1.autodisplay = false then get the blob info
  408.   manually or  else the vcl will do it automatically}
  409.  
  410.   If not TDBMultiImage1.autodisplay then TDBMultiImage1.GetInfoAndType;
  411.  
  412.  {Show the user the blob info}
  413.   Edit1.text:='This blob image is a '+TDBMultiImage1.BFiletype;
  414.   Edit2.text:=IntToStr(TDBMultiImage1.Bwidth);
  415.   Edit3.text:=IntToStr(TDBMultiImage1.BHeight);
  416.   Edit4.text:=IntToStr(TDBMultiImage1.Bbitspixel);
  417.   Edit5.text:=IntToStr(TDBMultiImage1.Bplanes);
  418.   Edit6.text:=IntToStr(TDBMultiImage1.Bnumcolors);
  419.   Edit7.text:=TDBMultiImage1.Bcompression;
  420.   Edit8.text:=IntToStr(TDBMultiImage1.BSize);
  421. end;
  422.  
  423. -----------------------------------------------------------------------
  424.  
  425. Procedure SaveToFile(SaveDialog1.FileName); The SaveToFile will save the
  426.                                             blob to a file without any
  427.                                             conversion.
  428.  
  429. Example
  430. -------
  431. procedure TForm1.BitBtn2Click(Sender: TObject);
  432.  var temp : string;
  433. begin
  434.  
  435.  {Save the current blob to a jpeg, pcx, gif or Bmp  file.  The SaveToFile
  436.  will save it as stored in the blob. No conversion is done here)
  437. ( Use SaveToFileAsBMP or SaveToFileAsJpeg to Convert to one another}
  438.  
  439.  {get the extension (filetype) of the stored  blob}
  440.  {GetInfoAndType returns the extension of the blob stored}
  441.  
  442.  if not table1.active then exit;
  443.  
  444.  temp:=TDBMultiImage1.GetInfoAndType;
  445.  
  446.  if temp = 'GIF' then begin
  447.  {set SaveDialog filter to display gif's only}
  448.   SaveDialog1.filter:='GIF files|*.GIF';
  449.  
  450.   {set SaveDialog Default extension}
  451.   SaveDialog1.DefaultExt:='GIF';
  452.  end else
  453.  
  454.   if temp = 'PCX' then begin
  455.  {set SaveDialog filter to display pcx's only}
  456.   SaveDialog1.filter:='PCX files|*.PCX';
  457.  
  458.   {set SaveDialog Default extension}
  459.   SaveDialog1.DefaultExt:='PCX';
  460.  end else
  461.  
  462.  if temp = 'JPG' then begin
  463.  {set SaveDialog filter to display jpeg's only}
  464.   SaveDialog1.filter:='Jpeg files|*.JPG';
  465.  
  466.   {set SaveDialog Default extension}
  467.   SaveDialog1.DefaultExt:='JPG';
  468.  end else
  469.  
  470.  if temp = 'BMP' then begin
  471.  {set SaveDialog filter to display bmp's only}
  472.   SaveDialog1.filter:='BMP files|*.BMP';
  473.   {set SaveDialog Default extension}
  474.   SaveDialog1.DefaultExt:='BMP';
  475.  end;
  476.  
  477.  {save it to file as stored in blob}
  478.  If SaveDialog1.Execute Then
  479.    TDBMultiImage1.SaveToFile(SaveDialog1.FileName);
  480.  
  481.  {reset the gauge to 0}
  482.  Gauge1.Progress:=0;
  483. end;
  484. -----------------------------------------------------------------------
  485.  
  486. property JPegDither     0: No dithering 24 bit
  487.                         1: One Pass No dither
  488.                         2: One Pass dither
  489.                         3: Two Pass No dither
  490.                         4: Two Pass dither
  491.  
  492. property JPegResolution 4 bit   (16 colors)
  493.                         8 bit   (256 colors)
  494.                         24 bit  (16 Million colors)
  495.  
  496.  
  497. Example
  498. ---------
  499. procedure TForm1.ResolutionClick(Sender: TObject);
  500.  {Set resolution and dither the image}
  501. begin
  502.  
  503.  if RadioButton1.Checked then begin    {Set resolution to 16 colors}
  504.   TDBMultiImage1.JpegResolution:=4;
  505.   {Set dither 1 pass ordered}
  506.   TDBMultiImage1.JpegDither:=2;
  507.  end else
  508.  
  509.  if RadioButton2.Checked then begin    {Set resolution to 256 colors}
  510.   TDBMultiImage1.JpegResolution:=8;
  511.  {Set dither 2 pass FS}
  512.   TDBMultiImage1.JpegDither:=4;
  513.  end else
  514.  
  515.  if RadioButton3.Checked then begin    {Set resolution to true color}
  516.   TDBMultiImage1.JpegResolution:=24;
  517.   {Set No dither (True color images don't have a palette)}
  518.   TDBMultiImage1.JpegDither:=0;
  519.  end;
  520.  
  521.  {Reload the image }
  522.  Table1.Refresh;
  523.  
  524.  {reset the gauge to 0}
  525.  Gauge1.Progress:=0;
  526. end;
  527. -----------------------------------------------------------------------
  528. property UPdateBlobAsJpeg
  529.  
  530. If True then the Blob Image will be updated to a Jpeg Blob.
  531.  
  532. If False then the Blob Image will be updated to a BMP Blob.
  533.  
  534. example
  535. --------
  536. procedure TForm1.UpdateAsJpeg(Sender: TObject);
  537. {Paste image from clipboard}
  538. begin
  539.    {does the clipboard have the right format?}
  540.    if not Clipboard.HasFormat(CF_PICTURE) then exit;
  541.    {Yep it does. Paste image from clipboard}
  542.  
  543.    TDBMultiImage1.UpdateBlobAsJpeg:=True;
  544.  
  545.    TDBMultiImage1.PastefromClipboard;
  546.  
  547.    {post the blob to the database in jpeg format}
  548.    Table1.Post;
  549.    {reset the gauge to 0}
  550.    Gauge1.Progress:=0;
  551. end;
  552.  
  553. procedure TForm1.UpdateAsBMP(Sender: TObject);
  554. {Paste image from clipboard}
  555. begin
  556.    {does the clipboard have the right format?}
  557.    if not Clipboard.HasFormat(CF_PICTURE) then exit
  558.    {Yep it does. Paste image from clipboard}
  559.  
  560.    TDBMultiImage1.UpdateBlobAsJpeg:=False;
  561.  
  562.    TDBMultiImage1.PastefromClipboard;
  563.  
  564.    {post the blob to the database in jpeg format}
  565.    Table1.Post;
  566.    {reset the gauge to 0}
  567.    Gauge1.Progress:=0;
  568. end;
  569.  
  570. -----------------------------------------------------------------------
  571.  
  572. DLL Image CallBack procedure
  573.  
  574. The callback procedure is generated by the DLL and has 2 main goals:
  575.  
  576. 1:   To show a progress bar to the user.
  577.  
  578. 2:   To process windows messages to give other windows programs the
  579.      chance to do what they have to do.
  580.  
  581. It's up to you, the application developer, to process the application's
  582. messageloop. You can do this by adding APPLICATION.PROCESSMESSAGES in the callback
  583. procedure.
  584.  
  585.  
  586. The Dll expects a callback procedure of the following type:
  587.  
  588. type
  589.  TCallBackFunction = procedure(i:integer);
  590.  
  591. var (pointer to the callback type)
  592.  TDBMultiImageCallBack   : TCallBackFunction;
  593.  
  594.  
  595. The are two things you MUST do to  add a callback to your app:
  596.  
  597. 1: You need to declare a Procedure of the type above with the EXPORT clause:
  598.  
  599. procedure MyCallBack(i : integer); export;
  600. begin
  601.   Form1.Gauge1.Progress:=i;
  602.   Application.ProcessMessages;
  603. end;
  604.  
  605. 2: You need to register the callback to the VCL. The best place to do that
  606.    is in the FormCreate function:
  607.  
  608. procedure TForm1.FormCreate(Sender: TObject);
  609. begin
  610.      TDBMultiImageCallBack:=MyCallBack;
  611. end;
  612. -----------------------------------------------------------------------
  613.  
  614. Bonus VCL
  615. -----------
  616.  
  617. Sample project:  MMBLOB
  618.  
  619. TDBMULTIMEDIA and TDBMEDIAPLAYER:
  620. AVI, MOV, MID, WAV, RMI, JPEG, BMP, GIF and PCX from a TBLOBField.
  621.  
  622. TDBMULTIMEDIA has the same functions as the data-aware TDBMultiImage with
  623. the following additions:
  624.  
  625. TDBMULTIMEDIA will automatically enable/disable the playback of
  626.  
  627.   AVI: If video for windows isn't installed;
  628.   MOV: If quicktime for windows isn't installed;
  629.   WAV: If no soundsupport is installed;
  630.   RMI: If no midi playback drivers are installed;
  631.   MID: If no midi playback drivers are installed.
  632.  
  633. -----------------------------------------------------------------------
  634.  
  635. function GetMultiMediaExtensions : String;
  636.  
  637. This function will return all multimedia extensions from the computer
  638. which running your app. supports in the filedialog filter format.
  639.  
  640. Example
  641. ----------
  642. procedure TBtnBottomDlg.BitBtn1Click(Sender: TObject);
  643. begin
  644.   {fill the OpenDialog filter with the MM extensions as found in the win.ini
  645.    (This means that the appropriate drivers are installed)}
  646.   OpenDialog1.filter:=DBMultiMedia1.GetMultiMediaExtensions;
  647.  
  648.   {Execute the open dialog box}
  649.   if OpenDialog1.Execute then begin
  650.  
  651.     {Place the Database in append mode}
  652.     Table1.Append;
  653.  
  654.     {Load the Multimedia into the Blob}
  655.     DBMultiMedia1.LoadfromFile(OpenDialog1.FileName);
  656.  
  657.     {Post that thing}
  658.     Table1.Post;
  659.   end;
  660.  
  661. For instance on my computer it returns:
  662.  
  663. 'All MultiMedia|*.bmp;*.gif;*.pcx;*.jpg;*.wav;*.mid;*.rmi;*.avi;*.mov;|
  664. BMP Files|*.bmp|
  665. GIF Files|*.gif|
  666. JPG Files|*.jpg|
  667. PCX Files|*.pcx|
  668. Wave Files|*.wav|
  669. Midi Files|*.mid|
  670. RMI Files|*.rmi|
  671. AVI Files|*.avi|
  672. Movie Files|*.mov'
  673.  
  674. If you run the example file incuded in the zip; MMBLOB you will notice the
  675. append MM dialogbox contains all the Multimedia supported by the VCL and
  676. your PC.
  677. -----------------------------------------------------------------------
  678.  
  679. property PathForTempFile
  680.  
  681. If directory or drive doesn't exists it defaults to C:\
  682.  
  683. TDBMULTIMEDIA saves its blobs first to a temporary file before it is
  684. being played and then deletes the temporary file. The reason is that in
  685. average multimedia blobs are too large in size to be played from memory.
  686.  
  687. Your application might be distributed and executed from a CD. In order
  688. to write a temporary file you need the supply a directory and drive.
  689.  
  690. Example
  691. ---------
  692. procedure TBtnBottomDlg.FormCreate(Sender: TObject);
  693. begin
  694.  
  695.   DBMultiMedia1.PathForTempFile:='C:\TEMP';
  696.  
  697. end;
  698.  
  699. -----------------------------------------------------------------------
  700. property AutoPlayMultiMedia
  701.  
  702. If AutoDisplay is true then the multimedia is played automatically;
  703.  
  704. Example
  705. ---------
  706. procedure TBtnBottomDlg.FormCreate(Sender: TObject);
  707. begin
  708.  
  709.   DBMultiMedia1.AutoPlayMultiMedia:=true;
  710.  
  711. end;
  712.  
  713. -----------------------------------------------------------------------
  714. property AutoRePlayMultiMedia
  715.  
  716. If AutoDisplay is true then the multimedia is replayed automatically;
  717.  
  718. Example
  719. ---------
  720. procedure TBtnBottomDlg.FormCreate(Sender: TObject);
  721. begin
  722.  
  723.   DBMultiMedia1.AutoRePlayMultiMedia:=true;
  724.  
  725. end;
  726. -----------------------------------------------------------------------
  727.  
  728. property AutoHideMediaPlayer
  729.  
  730. If the blobfield doesn't contains multimedia it will hide the attached
  731. MediaPlayer automatically.
  732.  
  733. Example
  734. ---------
  735. procedure TBtnBottomDlg.FormCreate(Sender: TObject);
  736. begin
  737.  
  738.   DBMultiMedia1.AutoHideMediaPlayer:=true;
  739.  
  740. end;
  741.  
  742. -----------------------------------------------------------------------
  743. property MediaPlayer:
  744.  
  745. The ImageLib comes with its own DBmediaplayer directly derived from
  746. Tmediaplayer. You need to drom one on your form and set the property
  747. MediaPlayer to for instance: DBmediaplayer1.
  748.  
  749. DON'T ATTACH ANY FILENAME TO IT AND SET AUTOOPEN TO FALSE, DBMultiMedia
  750. will take care of opening and closing the meiaplayer.
  751.  
  752. In order to display the video in the exact retangle of your DBMultiMedia
  753. you'll need to supply a display and rect to the DBMediaPlayer.
  754.  
  755. EXAMPLE
  756. ---------
  757.  
  758. Set the Video display rectangle to the rectangle of the blob window}
  759. BMediaPlayer1.DisplayRect:=Rect(0,0,DBMultiMedia1.Width,DBMultiMedia1.Height);
  760.  
  761. {Set the Video display to the the display of the blob window}
  762. DBMediaPlayer1.Display:=DBMultiMedia1;
  763.  
  764. -----------------------------------------------------------------------
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772. -----------------------------------------------------------------------
  773. Image Read Formats Supported:
  774.  
  775. JPEG
  776. GIF
  777. PCX
  778. BMP
  779. WMF (Delphi Inherited)
  780. ICO (Delphi Inherited)
  781.  
  782. Image Write Formats Supported:
  783.  
  784. JPEG
  785. BMP
  786. WMF (Delphi Inherited)
  787. ICO (Delphi Inherited)
  788.  
  789. PASCAL AND DELPHI DLL Calls
  790.  
  791. No enhanced documentation provided with the shareware version.
  792.  
  793. PASCAL AND DELPHI LIBRARY INTERFACE Calls
  794.  
  795. The dll functions above are translated using DLL20LIN.PAS:
  796.  
  797. ----------------------------------------------------------------------
  798.  
  799. Unit DLL20LIN;
  800.  
  801. {Copyright Jan Dekkers / Kevin Adams}
  802.  
  803. interface
  804.  
  805. uses
  806.   WinTypes, Graphics, SYSUtils, Dialogs;
  807.  
  808. type
  809.  TCallBackFunction = procedure(i:integer);
  810.  
  811.  
  812. {Interface call. GetMultiBitmap, for usage example}
  813. Function jpgfile(filename          : String;
  814.                  resolution        : integer;
  815.                  option            : integer;
  816.             var  Bitmap            : TBitmap;
  817.            CallBackFunction        : TCallBackFunction) : Boolean;
  818.  
  819. {Interface call. SaveAsJpg, for usage example}
  820. Function putjpgfile(filename       : String;
  821.                     quality        : integer;
  822.                     smooth         : integer;
  823.                     Bitmap         : TBitmap;
  824.              CallBackFunction      : TCallBackFunction) : Boolean;
  825.  
  826.  
  827. {Interface call. SaveAsBMP, for usage example}
  828. Function putbmpfile(filename       : String;
  829.                     Bitmap         : TBitmap;
  830.              CallBackFunction      : TCallBackFunction) : Boolean;
  831.  
  832.  
  833. {Interface call. GetMultiBitmap, for usage example}
  834. Function giffile(filename          : string;
  835.             var  Bitmap            : TBitmap;
  836.          CallBackFunction          : TCallBackFunction) : Boolean;
  837.  
  838.  
  839. {Interface call. GetMultiBitmap, for usage example}
  840. Function bmpfile(filename          : string;
  841.             var  Bitmap            : TBitmap;
  842.          CallBackFunction          : TCallBackFunction) : Boolean;
  843.  
  844.  
  845. {Interface call. GetMultiBitmap, for usage example}
  846. Function pcxfile(filename          : string;
  847.             var  Bitmap            : TBitmap;
  848.          CallBackFunction          : TCallBackFunction) : Boolean;
  849.  
  850.  
  851. {Interface call. LoadPicture, for usage example}
  852. Function jpgblob(filePoint         : Pointer;
  853.                   Size             : LongInt;
  854.                   resolution       : integer;
  855.                   option           : integer;
  856.              var  Bitmap           : TBitmap;
  857.             CallBackFunction       : TCallBackFunction): Boolean;
  858.  
  859. {Interface call. LoadPicture, for usage example}
  860. Function  gifblob(filePoint        : Pointer;
  861.                   Size             : LongInt;
  862.              var  Bitmap           : TBitmap;
  863.             CallBackFunction       : TCallBackFunction): Boolean;
  864.  
  865. {Interface call. LoadPicture, for usage example}
  866. Function  pcxblob(filePoint        : Pointer;
  867.                   Size             : LongInt;
  868.              var  Bitmap           : TBitmap;
  869.             CallBackFunction       : TCallBackFunction): Boolean;
  870.  
  871. {Interface call. LoadPicture, for usage example}
  872. Function  bmpblob(filePoint        : Pointer;
  873.                   Size             : LongInt;
  874.              var  Bitmap           : TBitmap;
  875.             CallBackFunction       : TCallBackFunction): Boolean;
  876.  
  877. {Interface call. UpdateData, for usage example}
  878. Function putjpgblob(filePoint      : Pointer;
  879.                      var Size      : LongInt;
  880.                       quality      : integer;
  881.                        smooth      : integer;
  882.                        Bitmap      : TBitmap;
  883.              CallBackFunction      : TCallBackFunction) : Boolean;
  884.  
  885. {Interface call. UpdateData, for usage example}
  886. Function putbmpblob(filePoint      : Pointer;
  887.                      var Size      : LongInt;
  888.                        Bitmap      : TBitmap;
  889.              CallBackFunction      : TCallBackFunction) : Boolean;
  890.  
  891. {Interface call. GetInfoAndType, for usage example}
  892. Function GetBlobInfo(filePoint     : Pointer;
  893.                      Size          : LongInt;
  894.                  var FileType      : String;
  895.                  var Fwidth        : Integer;
  896.                  var FHeight       : Integer;
  897.                  var Fbitspixel    : Integer;
  898.                  var Fplanes       : Integer;
  899.                  var Fnumcolors    : Integer;
  900.                  var Fcompression  : String) : Boolean;
  901.  
  902. {Interface call. GetInfoAndType, for usage example}
  903. Function GetFileInfo(fileName      : String;
  904.                  var FileType      : String;
  905.                  var Fwidth        : Integer;
  906.                  var FHeight       : Integer;
  907.                  var Fbitspixel    : Integer;
  908.                  var Fplanes       : Integer;
  909.                  var Fnumcolors    : Integer;
  910.                  var Fcompression  : String) : Boolean;
  911.  
  912. {DLL call}
  913. Function readjpgstream(filePoint   : Pointer;
  914.                        Size        : LongInt;
  915.                        resolution  : integer;
  916.                        scale       : integer;
  917.                        option      : integer;
  918.                        password    : integer;
  919.                    var hBmp        : HBitmap;
  920.                    var hPal        : HPalette;
  921.                    CallBackFunction: TCallBackFunction) : byte; Far;
  922.  
  923. {DLL call}
  924. Function readjpgfile(filename      : pchar;
  925.                      resolution    : integer;
  926.                      scale         : integer;
  927.                      option        : integer;
  928.                      password      : integer;
  929.                  var hBmp          : HBitmap;
  930.                  var hPal          : HPalette;
  931.                  CallBackFunction  : TCallBackFunction) : byte; Far;
  932.  
  933. {DLL call}
  934. Function writejpgfile(filename     : pchar;
  935.                       quality      : integer;
  936.                       smooth       : integer;
  937.                       password     : integer;
  938.                       hBmp         : HBitmap;
  939.                       hPal         : HPalette;
  940.               CallBackFunction     : TCallBackFunction) : byte; Far;
  941.  
  942.  
  943. {DLL call}
  944. Function writebmpfile(filename     : pchar;
  945.                       password     : integer;
  946.                       hBmp         : HBitmap;
  947.                       hPal         : HPalette;
  948.               CallBackFunction     : TCallBackFunction) : byte; Far;
  949.  
  950. {DLL call}
  951. Function readgiffile(filename      : pchar;
  952.                      password      : integer;
  953.                  var hBmp          : HBitmap;
  954.                  var hPal          : HPalette;
  955.                  CallBackFunction  : TCallBackFunction) : byte; Far;
  956.  
  957. {DLL call}
  958. Function readbmpfile(filename      : pchar;
  959.                      password      : integer;
  960.                  var hBmp          : HBitmap;
  961.                  var hPal          : HPalette;
  962.                  CallBackFunction  : TCallBackFunction) : byte; Far;
  963.  
  964. {DLL call}
  965. Function readpcxfile(filename      : pchar;
  966.                      password      : integer;
  967.                  var hBmp          : HBitmap;
  968.                  var hPal          : HPalette;
  969.                  CallBackFunction  : TCallBackFunction) : byte; Far;
  970.  
  971. {DLL call}
  972. Function readpcxstream(filePoint   : Pointer;
  973.                        Size        : LongInt;
  974.                        password    : integer;
  975.                    var hBmp        : HBitmap;
  976.                    var hPal        : HPalette;
  977.                    CallBackFunction: TCallBackFunction) : byte; Far;
  978.  
  979. {DLL call}
  980. Function readbmpstream(filePoint   : Pointer;
  981.                        Size        : LongInt;
  982.                        password    : integer;
  983.                    var hBmp        : HBitmap;
  984.                    var hPal        : HPalette;
  985.                    CallBackFunction: TCallBackFunction) : byte; Far;
  986.  
  987. {DLL call}
  988. Function readgifstream(filePoint   : Pointer;
  989.                        Size        : LongInt;
  990.                        password    : integer;
  991.                    var hBmp        : HBitmap;
  992.                    var hPal        : HPalette;
  993.                    CallBackFunction: TCallBackFunction) : byte; Far;
  994.  
  995. {DLL call}
  996. Function streaminfo(filePoint      : Pointer;
  997.                     Size           : LongInt;
  998.                     FileType       : PChar;
  999.                 var Fwidth         : Integer;
  1000.                 var FHeight        : Integer;
  1001.                 var Fbitspixel     : Integer;
  1002.                 var Fplanes        : Integer;
  1003.                 var Fnumcolors     : Integer;
  1004.                     Fcompression   : PChar) : byte; Far;
  1005.  
  1006. {DLL call}
  1007. Function   fileinfo(filename       : PChar;
  1008.                     FileType       : PChar;
  1009.                 var Fwidth         : Integer;
  1010.                 var FHeight        : Integer;
  1011.                 var Fbitspixel     : Integer;
  1012.                 var Fplanes        : Integer;
  1013.                 var Fnumcolors     : Integer;
  1014.                     Fcompression   : PChar) : byte; Far;
  1015.  
  1016. {DLL call}
  1017. Function writejpegstream(filePoint : Pointer;
  1018.                      var Size      : LongInt;
  1019.                          quality   : integer;
  1020.                          smooth    : integer;
  1021.                          password  : integer;
  1022.                          hBmp      : HBitmap;
  1023.                          hPal      : HPalette;
  1024.                   CallBackFunction : TCallBackFunction) : byte; Far;
  1025.  
  1026. {DLL call}
  1027. Function  writebmpstream(filePoint : Pointer;
  1028.                      var Size      : LongInt;
  1029.                          password  : integer;
  1030.                          hBmp      : HBitmap;
  1031.                          hPal      : HPalette;
  1032.                   CallBackFunction : TCallBackFunction) : byte; Far;
  1033.  
  1034.  
  1035. implementation
  1036. {The implementation part of DLL20LIN.PAS which includes the password
  1037. will be supplied to you upon registration.
  1038.  
  1039. -----------------------------------------------------------------------
  1040.  
  1041. How to register
  1042.  
  1043. GO SWREG.  ID = 6791. Registration using SWREG is $69.-.
  1044.  
  1045. To register  by mail send a check or moneyorder of $65.- to :
  1046.  
  1047. Jan Dekkers
  1048. 11956 Riverside Drive, 206
  1049. North Hollywood CA 91607
  1050.  
  1051. You will receive the DLL20LIN.PAS and a password to access the DLL.
  1052. This will eliminate the shareware messages.
  1053.  
  1054. -----------------------------------------------------------------------
  1055.  
  1056. I just would like to say a few nice words about Turbopower. I've used
  1057. Turbopowers' products for over 4 years now and am very impressed with their
  1058. state of the art development libraries. Their technical support is the best
  1059. I have ever experienced. They provide a good example for Kevin and me of how
  1060. to do business and how to treat customers.
  1061.  
  1062. Turbopower's products:
  1063.  
  1064.   Async Professional, B-Tree Filer, Object Professional, TSRs
  1065.   Turbo Analyst, Turbo Professional, Data Entry Workshop
  1066.   Win/Sys Library, and their latest great Delphi product, Orpheus
  1067.  
  1068. on CompuServe, Go PCVENB to download their free trial libraries.
  1069.  
  1070. Contacting TurboPower Sales
  1071. ----------------------------
  1072.  Telephone   :  800-333-4160 (sales in the U.S. & Canada)
  1073.                 719-260-9136 (international sales)
  1074.                 719-260-7151 (fax)
  1075.  CompuServe  :  76004,2611
  1076.  Internet    :  76004.2611@compuserve.com
  1077.  Postal mail :  TurboPower Software
  1078.                 P.O. Box 49009
  1079.                 Colorado Springs, CO 80949-9009
  1080.  
  1081. _________________________________________________________________________
  1082.  
  1083. Gif and Tiff uses LZW compression which is patented by Unisys. On CompuServe
  1084. GO PICS to obtain information about the Unisys patents. This work "jpeg file
  1085. i/o" is based in part on the Independent JPEG Group
  1086.